<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class PermissionListModel extends Model
{
    protected $table = 'permission_list';
    protected $guarded = [];

    public $timestamps = false;

    public function identity() {
        $this->hasManyThrough(
            IdentityModel::class,
            IdentityPermissionListModel::class,
            'permission_list_id',
            'id',
            'id',
            'identity_id'
        );
    }

    public function menu() {
        return $this->belongsTo(MenuModel::class, 'menu_id', 'id');
    }

    public function operation() {
        return $this->belongsTo(OperationModel::class, 'operation_id', 'id');
    }
}